
clear 

** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** subset for placebo test, "treatment" set for 1947 **

drop if YOB_BIN_5 < 1945
drop if YOB_BIN_5 > 1949

** regressions ** 

xi: reghdfe MOB did_ANY47 Arabic Female *_itTREATED47 *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_placebo47

xi: reghdfe EDU_YRS did_edu_ANY47 Arabic Female *_itTREATED47EDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_YRS_placebo47

xi: reghdfe French_Lit did_edu_ANY47 Arabic Female *_itTREATED47EDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_placebo47

xi: reghdfe Schooling did_edu_ANY47 Arabic Female *_itTREATED47EDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_placebo47


** output table **

#delimit ; 
estout 
	   m_MOB_placebo47
	   m_YRS_placebo47
	   m_LIT_placebo47
	   m_School_placebo47
       using "${output}/tables/TableA3.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
	   	   varlabels(did_ANY49 "Difference in Differences, Placebo 1949" did_edu_ANY49 "Difference in Differences, Placebo 1949"  
		   did_ANY48 "Difference in Differences, Placebo 1948" did_edu_ANY48 "Difference in Differences, Placebo 1948"
		   did_ANY47 "Difference in Differences, Placebo 1947" did_edu_ANY47 "Difference in Differences, Placebo 1947"
		   did_ANY46 "Difference in Differences, Placebo 1946" did_edu_ANY46 "Difference in Differences, Placebo 1946"
		   Female "Female " Arabic "First Language Arabic")
keep(did_ANY47 did_edu_ANY47)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Effect of European Settlement and Placebo Treatment on Registration and Compulsory Education, 1947}        
           \label{tab:DiD_placebo47}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering Registration} 
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling}   
		   & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic \& French} 
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling, Years}                    \\           
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.9\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
#delimit cr
